from selenium.webdriver.common.by import By
from common.Utils import BlogDirver

class BlogDetail:
    url = "http://8.137.19.140:9090/blog_detail.html?blogId=9542"
    driver = BlogDirver.driver
    title = driver.title
    if not title=="博客详情页":
        driver.get(url)

    def DetailCheck(self):
        self.driver.find_element(By.CSS_SELECTOR,"body > div.container > div.right > div > div.title")
        self.driver.find_element(By.CSS_SELECTOR, "body > div.container > div.right > div > div.date")
        self.driver.find_element(By.CSS_SELECTOR, "#h2-u5728u8FD9u91CCu5199u4E0Bu4E00u7BC7u535Au5BA2")
        assert self.driver.find_element(By.CSS_SELECTOR,"body > div.container > div.right > div > div.operating > button:nth-child(1)").text == "编辑"
        assert self.driver.find_element(By.CSS_SELECTOR,"body > div.container > div.right > div > div.operating > button:nth-child(2)").text == "删除"
        self.driver.find_element(By.CSS_SELECTOR,"body > div.nav > a:nth-child(5)").click()

